//
//  LJHomeTitleView.swift
//  LJWeibo
//
//  Created by Raymond on 15/12/20.
//  Copyright © 2015年 liu. All rights reserved.
//

import UIKit

class LJHomeTitleView: UIButton {

    init(imageName: String, title: String) {
        super.init(frame: CGRectZero)
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        sizeToFit()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        titleLabel?.frame.origin.x = 0
        
        imageView?.frame.origin.x = CGRectGetWidth(titleLabel!.frame)+3
    }
}
